SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO







CREATE PROCEDURE [dbo].[usp_UpdateLecture]
    (
      @JOL_Lecture_No INT ,--编号	
      --@JOL_Lecture_Purpose INT,--场地用途
      @JOL_Lecture_Title VARCHAR(50) ,--活动标题
      @JOL_Lecture_OldTitle VARCHAR(50) ,--原活动标题
      @JOL_Lecture_Linkman VARCHAR(50) ,--联系人
      @JOL_Lecture_Mobile VARCHAR(50) ,--手机
      @JOL_Lecture_Email VARCHAR(50) ,--邮件
      @JOL_Lecture_Phone VARCHAR(50) ,--电话
      @JOL_Lecture_Fax VARCHAR(50) ,--传真
      @JOL_Lecture_Body NTEXT ,--正文
      @JOL_Lecture_IsSetTop BIT ,--是否置顶
      @JOL_Lecture_RequireNumber INT ,--拟招人数
      @JOL_Lecture_RequireStudyLevel VARCHAR(50) ,--学历要求
      @JOL_Lecture_UpdateTime DATETIME ,--添加时间
      @JOL_Lecture_UpdateUser VARCHAR(50) ,--添加账户
      @JOL_Field_ApplyCompany VARCHAR(50) ,--申请单位 
      @JOL_Field_ApplyTime DATETIME ,--申请时间
      @JOL_Field_ApplyPosition VARCHAR(50) ,--地点
      @JOL_Field_SeatNumber INT ,--场地申请人数
      @JOL_Field_IsProvideMultimedia BIT ,--是否提供多媒体
      @JOL_Field_IsNeedInvoice BIT ,--是否需要发票
      @JOL_Field_InvoiceBeginning VARCHAR(50) ,--发票开头
      @JOL_Field_InvoiceProject VARCHAR(50) ,--发票项目
      @JOL_Field_IsPaidMoney BIT ,--是否已缴费，中心管理员填写
      @JOL_Field_UpdateTime DATETIME ,--添加时间
      @JOL_Field_UpdateUser VARCHAR(50) ,--添加账户
      @JOL_Field_Remark NTEXT ,--备注
      @JOL_Lecture_VerifyStatus VARCHAR(50) ,
      @JOL_ApplyField_EndTime DATETIME ,
      @JOL_ApplyField_VerifyUser VARCHAR(50)
    )
AS 
    DECLARE @Purpose INT
    SET @Purpose = ( SELECT JOL_Lecture_Purpose
                     FROM   dbo.JOL_Lecture
                     WHERE  JOL_Lecture_No = @JOL_Lecture_No
                   )
    --DECLARE @ID INT
    --SET @ID = (
    --            SELECT  JOL_Field_No
    --            FROM    dbo.JOL_ApplyField
    --            WHERE   JOL_Lecture_Purpose=@Purpose
    --          )
    UPDATE  dbo.JOL_Lecture
    SET     JOL_Lecture_Title = @JOL_Lecture_Title ,--活动标题
            JOL_Lecture_Linkman = @JOL_Lecture_Linkman ,--联系人
            JOL_Lecture_Mobile = @JOL_Lecture_Mobile ,--手机
            JOL_Lecture_Email = @JOL_Lecture_Email ,--邮件
            JOL_Lecture_Phone = @JOL_Lecture_Phone ,--电话
            JOL_Lecture_Fax = @JOL_Lecture_Fax ,--传真
            JOL_Lecture_Body = @JOL_Lecture_Body ,--正文
            JOL_Lecture_IsSetTop = @JOL_Lecture_IsSetTop ,--是否置顶
            JOL_Lecture_RequireNumber = @JOL_Lecture_RequireNumber ,--拟招人数
            JOL_Lecture_RequireStudyLevel = @JOL_Lecture_RequireStudyLevel ,--学历要求
            JOL_Lecture_UpdateTime = GETDATE() ,--添加时间
            JOL_Lecture_UpdateUser = @JOL_Lecture_UpdateUser ,--添加账户
            JOL_Lecture_VerifyStatus = @JOL_Lecture_VerifyStatus ,
            JOL_Lecture_VerifyTime = CASE @JOL_Lecture_VerifyStatus
                                       WHEN '已审核' THEN GETDATE()
                                       ELSE NULL
                                     END ,
            JOL_Lecture_VerifyUser = @JOL_ApplyField_VerifyUser ,
            JOL_Lecture_IsSendEmail = 0
    WHERE   JOL_Lecture_No = @JOL_Lecture_No
    UPDATE  dbo.JOL_ApplyField
    SET     JOL_Field_ApplyCompany = @JOL_Field_ApplyCompany ,--申请单位
            JOL_Field_Action = @JOL_Lecture_Title ,
            JOL_Field_ApplyTime = @JOL_Field_ApplyTime ,--申请时间
            JOL_Field_ApplyPosition = @JOL_Field_ApplyPosition ,--地点
            JOL_Field_SeatNumber = @JOL_Field_SeatNumber ,--场地申请人数
            JOL_Field_IsProvideMultimedia = @JOL_Field_IsProvideMultimedia ,--是否提供多媒体
            JOL_Field_IsNeedInvoice = @JOL_Field_IsNeedInvoice ,--是否需要发票
            JOL_Field_InvoiceBeginning = @JOL_Field_InvoiceBeginning ,--发票开头
            JOL_Field_InvoiceProject = @JOL_Field_InvoiceProject ,--发票项目
            JOL_Field_IsPaidMoney = @JOL_Field_IsPaidMoney ,--是否已缴费，中心管理员填写
            JOL_Field_UpdateTime = GETDATE() ,--添加时间
            JOL_Field_UpdateUser = @JOL_Field_UpdateUser ,--添加账户
            JOL_Field_VerifyStatus = @JOL_Lecture_VerifyStatus ,
            JOL_Field_VerifyUser = @JOL_ApplyField_VerifyUser ,
            JOL_Field_IsSendEmail = 0 ,
            JOL_Field_Remark = @JOL_Field_Remark ,--备注
            JOL_ApplyField_EndTime = @JOL_ApplyField_EndTime ,
            JOL_ApplyField_Phone = @JOL_Lecture_Phone ,
            JOL_ApplyField_Fax = @JOL_Lecture_Fax ,
            JOL_ApplyField_Email = @JOL_Lecture_Email
    WHERE   JOL_Field_No = @Purpose







GO
